#ifndef _MYLIST_H_H_
#define _MYLIST_H_H_
class MyNode
{
	friend class MyList;
public:
	MyNode();
protected:
	~MyNode()
	{
	}
protected:
	MyNode *pPrev;
	MyNode *pNext;
	void   *pData;
	MyList *pList;
public:
	MyList* GetList()
	{
		return pList;
	}

	void* GetData()
	{
		return pData;
	}

	MyNode* GetNext()
	{
		return pNext;
	}

	MyNode* GetPrev()
	{
		return pPrev;
	}
};

class MyList
{
public:
	MyList();
	~MyList()
	{
		clear();
	}
private:
	MyNode* pHead,*pTail;
	unsigned int    dwSize;	
public:
	MyNode* push_back(void *pData);
	MyNode* push_front(void *pData);

	bool    erase(MyNode *pNode);
	bool    cut(MyNode *pNode);

	bool    splice_back(MyNode *pNode);
	bool    splice_front(MyNode *pNode);

	void*   pop_back();
	void*   pop_front();

	MyNode* back()
	{
		return pTail;
	}

	MyNode* front()
	{
		return pHead;
	}

	void    clear(bool bDelData = false);
	unsigned int   size()
	{
		return dwSize;
	}
};
#endif